import xadmin
from .models import EmailVerifyRecord, Banner
from xadmin import views


class BaseSetting(object):  # 主题设置
    enable_themes = True
    use_bootswatch = True


class GlobalSettings(object):
    site_title = "我的三天django系统！"  # 左上角页头
    site_footer = "我的三天django系统"  # 页尾
    menu_style = "accordion"  # 菜单栏可以收缩


class EmailVerifyRecordAdmin(object):
    list_display = ["code", "email", "send_type", "send_time"]
    search_fields = ["code", "email", "send_type"]
    list_filter = ["code", "email", "send_type", "send_time"]


class BannerAdmin(object):
    list_display = ["title", "image", "url", "index", "add_time"]
    search_fields = ["title", "image", "url", "index"]
    list_filter = ["title", "image", "url", "index", "add_time"]


xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
